package com.eastfair.venuebooking.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.eastfair.database.mybatis.typehandler.M9EncryptHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 客户及线索联系人表
 * </p>
 *
 * @author dqq
 * @since 2023-01-31
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "vb_contact", autoResultMap = true)
@ApiModel(value = "Contact", description = "客户及线索联系人表")
@AllArgsConstructor
public class Contact extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 联系人名称
     */
    @ApiModelProperty(value = "联系人名称")
    @Size(max = 64, message = "联系人名称长度不能超过64")
    @TableField(value = "contact_name", condition = LIKE)
    @Excel(name = "联系人名称")
    private String contactName;

    /**
     * 性别，尊称
     */
    @ApiModelProperty(value = "性别，尊称")
    @Size(max = 64, message = "性别，尊称长度不能超过64")
    @TableField(value = "gender", condition = LIKE)
    @Excel(name = "性别，尊称")
    private String gender;

    /**
     * 角色
     */
    @ApiModelProperty(value = "角色")
    @Size(max = 64, message = "角色长度不能超过64")
    @TableField(value = "role", condition = LIKE)
    @Excel(name = "角色")
    private String role;

    /**
     * 生日
     */
    @ApiModelProperty(value = "生日")
    @TableField(value = "birthday")
    @Excel(name = "生日", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDate birthday;

    /**
     * 岗位
     */
    @ApiModelProperty(value = "岗位")
    @Size(max = 64, message = "岗位长度不能超过64")
    @TableField(value = "post", condition = LIKE)
    @Excel(name = "岗位")
    private String post;

    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号")
    @Size(max = 20, message = "手机号长度不能超过20")
    @TableField(value = "mobile", condition = LIKE, typeHandler = M9EncryptHandler.class)
    @Excel(name = "手机号")
    private String mobile;

    /**
     * 固定电话
     */
    @ApiModelProperty(value = "固定电话")
    @Size(max = 20, message = "固定电话长度不能超过20")
    @TableField(value = "phone", condition = LIKE)
    @Excel(name = "固定电话")
    private String phone;

    /**
     * 传真
     */
    @ApiModelProperty(value = "传真")
    @Size(max = 20, message = "传真长度不能超过20")
    @TableField(value = "fax", condition = LIKE)
    @Excel(name = "传真")
    private String fax;

    /**
     * 邮箱
     */
    @ApiModelProperty(value = "邮箱")
    @Size(max = 20, message = "邮箱长度不能超过20")
    @TableField(value = "mail", condition = LIKE)
    @Excel(name = "邮箱")
    private String mail;

    /**
     * 微信账号
     */
    @ApiModelProperty(value = "微信账号")
    @Size(max = 20, message = "微信账号长度不能超过20")
    @TableField(value = "wechat", condition = LIKE)
    @Excel(name = "微信账号")
    private String wechat;

    /**
     * qq号
     */
    @ApiModelProperty(value = "qq号")
    @Size(max = 20, message = "qq号长度不能超过20")
    @TableField(value = "qq", condition = LIKE)
    @Excel(name = "qq号")
    private String qq;

    /**
     * 所在地区
     */
    @ApiModelProperty(value = "所在地区")
    @Size(max = 64, message = "所在地区长度不能超过64")
    @TableField(value = "region", condition = LIKE)
    @Excel(name = "所在地区")
    private String region;

    /**
     * 详细地址
     */
    @ApiModelProperty(value = "详细地址")
    @Size(max = 64, message = "详细地址长度不能超过64")
    @TableField(value = "address", condition = LIKE)
    @Excel(name = "详细地址")
    private String address;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Size(max = 255, message = "备注长度不能超过255")
    @TableField(value = "remark", condition = LIKE)
    @Excel(name = "备注")
    private String remark;

    /**
     * cms系统同步状态 0:待同步;1:已同步
     */
    @ApiModelProperty(value = "cms系统同步状态 0:待同步;1:已同步")
    @NotNull(message = "请填写cms系统同步状态 0:待同步;1:已同步")
    @TableField(value = "cms_sync")
    @Excel(name = "cms系统同步状态 0:待同步;1:已同步")
    private Integer cmsSync;


    @Builder
    public Contact(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    String contactName, String gender, String role, LocalDate birthday, String post, String mobile, 
                    String phone, String fax, String mail, String wechat, String qq, String region, 
                    String address, String remark, Integer cmsSync) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.contactName = contactName;
        this.gender = gender;
        this.role = role;
        this.birthday = birthday;
        this.post = post;
        this.mobile = mobile;
        this.phone = phone;
        this.fax = fax;
        this.mail = mail;
        this.wechat = wechat;
        this.qq = qq;
        this.region = region;
        this.address = address;
        this.remark = remark;
        this.cmsSync = cmsSync;
    }

}
